package com.example.administrator.testc.DrawerLayouts;/**
 * Created by Administrator on 2016/5/9 0009.
 */

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.FrameLayout;

import com.example.administrator.testc.R;

/**
 * >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>类描述
 * >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>属性描述
 * >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>方法描述
 */
public class TestMain extends AppCompatActivity {

    private DrawerLayout drawer_;
    private FrameLayout drawer_left_t, drawer_left_f;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.drawer_layout);
        drawer_left_t = (FrameLayout) findViewById(R.id.drawer_left_t);
        drawer_left_f = (FrameLayout) findViewById(R.id.drawer_left_f);
        drawer_ = (DrawerLayout) findViewById(R.id.drawer_);
        drawer_.setDrawerListener(new DrawerLayout.SimpleDrawerListener() {
            @Override
            public void onDrawerClosed(View drawerView) {
                super.onDrawerClosed(drawerView);
            }

            @Override
            public void onDrawerOpened(View drawerView) {
                super.onDrawerOpened(drawerView);
                int random = (int) ((Math.random() * 10) % 2);
                Log.i("TAGSS", "random is " + random);
                if(random != 0){
                    drawer_left_t.setVisibility(View.GONE);
                    drawer_left_f.setVisibility(View.VISIBLE);
                }else{
                    drawer_left_f.setVisibility(View.GONE);
                    drawer_left_t.setVisibility(View.VISIBLE);
                }
            }
        });
    }
}
